Skip to content

test: backfill coverage and restore the 100% gate - #81

Open
JacobCoffee wants to merge 3 commits into
feat/configurable-managefrom
test/coverage-backfill
Open

JacobCoffee wants to merge 3 commits into
feat/configurable-managefrom
test/coverage-backfill

Conversation

@JacobCoffee

Copy link
Copy Markdown
Owner

Stacked on #80. main sits at 94% line coverage (the coverage job never ran while main's tests were red), so #80 ratchets fail_under to 94; this PR brings the suite to 100% and restores fail_under = 100.

Tests

New test files only (no changes to existing tests): sponsors services/views/admin/models, manage views / bulk purchases / letters / financial / reports / analytics, terminal and Stripe client, webhooks, purchase orders, check-in, registration admin, conference/pretalx/programs model __str__s, setup_groups. External boundaries (Stripe SDK, PSF API client) are mocked; everything else runs against the DB.

Production changes found while covering

  • get_session_rating_analytics crashed on every call (FieldError: Expression contains mixed types: FloatField, DecimalField from Coalesce(Avg("score"), Value(Decimal))); Avg now declares output_field=DecimalField().
  • ConferenceEditView.form_valid was unreachable (post() goes through _forms_valid, which calls super().form_valid), so its success message never showed; removed it and send the message from _forms_valid.

Verification

uv run python -m pytest -n auto --cov=src/django_program: 2460 passed, 100% (12391/12391).

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T01:14:09.413409Z fa41ead PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Beyond the inline finding, I checked whether the bare DecimalField() in get_session_rating_analytics (reports_analytics.py:215) could still fail or return the wrong type depending on the database backend. I ruled it out: the result goes through Decimal(str(...)) right away, so it is normalized whatever type the backend returns.

Extended reasoning...

The ruled-out concern was that a DecimalField with no precision might be converted differently by each database backend. The next line wraps the aggregate in Decimal(str(...)), so the value comes out as a Decimal either way.

Comment thread src/django_program/manage/views.py Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa41eade98

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pyproject.toml Resolved
@JacobCoffee
JacobCoffee force-pushed the test/coverage-backfill branch from fa41ead to 46a877f Compare November 6, 2026 01:38

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

Still open from earlier reviews (1):

  • Unresolved: 1 minor or pre-existing.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest push fixes the issue I raised earlier: _forms_valid now saves the conference and its KPI targets inside one transaction.atomic() block, and sends the success message only after both saves commit. I found no new bugs, but a human should still review this before merge. It adds about 5,600 lines of tests, and the earlier third-party comment on the fail_under line is not visible to me, so I can't confirm it was resolved.

What was reviewed:

  • ConferenceEditView: post() goes only through _forms_valid, transaction is already imported, and the removed form_valid override no longer runs super().form_valid a second time.
  • get_session_rating_analytics: Avg(..., output_field=DecimalField()) now matches the Decimal Value(_ZERO) fallback, and the result is still normalized with Decimal(str(...)).
  • The badge font test now uses reportlab's bundled Vera.ttf instead of the macOS-only Geneva path.
Extended reasoning...

This change raises the coverage gate in pyproject.toml from 94 to 100 and adds about 5,600 lines of new tests. It also makes two small production fixes in src/django_program/manage/views.py (one atomic save for the conference and KPI forms) and src/django_program/manage/reports_analytics.py (an output_field on Avg). It touches no auth, crypto, or injection-sensitive code. I deferred because the change is large, and because a third-party inline comment on the fail_under line has an author reply whose content I can't see, so I can't confirm that thread was addressed.

@JacobCoffee
JacobCoffee force-pushed the test/coverage-backfill branch from c096e4e to dc87137 Compare November 6, 2026 01:52

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the latest push and didn't find any bugs. The earlier KPI-save concern is fixed: both saves now run inside one transaction.atomic(), and the success message is sent only after that block commits. The PR still adds about 5,600 lines of tests and raises the coverage gate to 100%, which I couldn't confirm by running the suite, so a human look would still be worthwhile.

What was reviewed:

  • ConferenceEditView._forms_valid in views.py: transaction was already imported, and nothing else depended on the removed form_valid override.
  • Avg("score", output_field=DecimalField()) in reports_analytics.py: this now matches the type of the Decimal zero Value inside Coalesce.
  • The badge font test in test_badges.py now uses reportlab's bundled Vera.ttf, so it no longer depends on a macOS-only font path.
Extended reasoning...

Apart from about 5,600 lines of new test modules, this push changes two production files with a few lines each: a Coalesce type fix in the reports analytics and an atomic conference/KPI save in ConferenceEditView. It touches no auth, permissions or injection-sensitive code. The latest commit addresses my earlier inline finding. I deferred because the change is large and depends on the suite reaching 100% coverage, which I couldn't run here to check. The other bot's comment on the coverage gate in pyproject.toml was resolved only by the PR author.

@JacobCoffee
JacobCoffee force-pushed the test/coverage-backfill branch 2 times, most recently from 228b167 to 0a51263 Compare November 6, 2026 03:50

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest push fixes the partial-save case I raised earlier on ConferenceEditView: the conference and KPI saves now run in one transaction.atomic() block, and the success message is added only after it commits. I didn't find any new bugs. A human should still look, because the earlier automated thread on the coverage gate at pyproject.toml:97 was resolved by the author, and about 5,600 lines of new tests is a lot to approve automatically.

What was reviewed:

  • _forms_valid in manage/views.py: transaction is already imported, and the duplicate conference save from the removed form_valid override is gone.
  • Avg("score", output_field=DecimalField()) in reports_analytics.py: its type now matches the Decimal Value in Coalesce.
  • The badge font test now uses reportlab's bundled Vera.ttf instead of the macOS-only Geneva font.
Extended reasoning...

The production changes are two small fixes. One makes the conference and KPI targets save atomic in ConferenceEditView. The other sets an explicit DecimalField output type on an Avg aggregate. The rest of the change is about 5,600 lines of new test files, plus raising the coverage gate in pyproject.toml from 94 to 100. None of it touches auth, permissions or crypto. I deferred instead of approving because an earlier automated reviewer thread on the pyproject.toml gate was resolved only by the author, and the test additions are too large for an automatic approval.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The latest push fixes the earlier point about ConferenceEditView: the conference and KPI saves now run in one transaction.atomic() block, and the success message is sent only after both commit.

What was reviewed:

  • _forms_valid in manage/views.py: transaction is already imported, the response from a single super().form_valid is returned, and the unreachable form_valid override is gone.
  • get_session_rating_analytics: giving Avg a DecimalField output fixes the mixed-type Coalesce error, and the Decimal(str(...)) cast after it still works.
  • test_badges.py: the font test now uses reportlab's bundled Vera.ttf, so it runs on Linux CI. Without that, the new fail_under = 100 gate would fail there.
Extended reasoning...

About 5,400 of the ~5,600 added lines are new test modules. The rest is the coverage gate going from 94 to 100 and two small source fixes in manage/views.py and manage/reports_analytics.py. None of it touches auth, permissions, crypto, injection or data exposure. The latest commit addresses the open atomicity comment on views.py. It also makes the badge font test portable, which plausibly answers the author-resolved thread on the pyproject.toml coverage gate. There is no CODEOWNERS file, and the source changes are small and self-contained.

…ference

- fix get_session_rating_analytics crash (mixed Float/Decimal in Coalesce)
- drop unreachable ConferenceEditView.form_valid; success message now sent
  from the path that runs
…t test

- a failed KPI save no longer leaves the conference edit committed
- font registration test uses reportlab's bundled Vera.ttf instead of a
  macOS-only system font, so the 100% gate holds on Linux
@JacobCoffee
JacobCoffee force-pushed the test/coverage-backfill branch from 0a51263 to 7808181 Compare November 7, 2026 02:14

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the latest push and found no bugs. The earlier note on ConferenceEditView is addressed: both saves now run in one transaction.atomic() block, and the success message is sent only after that block finishes. I'm not approving because an automated reviewer's thread on pyproject.toml (the fail_under = 100 line) was resolved by the author, and I can't tell from here whether its point was handled.

What was reviewed:

  • _forms_valid in manage/views.py: the duplicate form_valid override is gone, a KPI save failure now rolls back the conference update, and transaction was already imported.
  • get_session_rating_analytics: Avg(..., output_field=DecimalField()) makes both Coalesce arguments Decimal, which fixes the mixed-type FieldError.
  • The badge font test now uses reportlab's bundled Vera.ttf instead of a macOS-only font, so it runs on every platform.
Extended reasoning...

The PR is almost entirely new test files (about 5,600 lines), plus two small production fixes in manage/reports_analytics.py and manage/views.py and a coverage gate raised from 94 to 100 in pyproject.toml. It touches no security-sensitive surface such as auth, permissions or injection. The latest commit wraps the conference and KPI saves in one transaction, which resolves the concern I raised earlier. Approval is held back because another bot's comment on pyproject.toml:97 was resolved only by the PR author, so it can't be confirmed as addressed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant